package com.ihisun.tmhcms.security.securitdao;

import com.ihisun.tmhcms.security.entity.SysMenuEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface SysMenuDao extends JpaRepository<SysMenuEntity,Long> {
    @Query(value = "select sm.menu_id,sm.`name`,sm.permission,sm.create_time,sm.update_time from sys_user_role sur INNER JOIN sys_role sr INNER JOIN sys_role_menu srm INNER JOIN sys_menu sm on sur.user_id=:id  and srm.menu_id=sm.menu_id",nativeQuery = true)
    public List<SysMenuEntity>findByMenuId(@Param("id") Long id);
}
